<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>五条人音乐盒</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        #panel {
            border: 1px solid #ddd;
            background-color: #fff;
            border-radius: 4px;
            width: 400px;
            padding: 20px;
            margin: 100px auto;
        }
        .panel-footer {
            text-align: center;
        }
    </style>
</head>
<body>
    <div id="panel">
        <div class="panel-title"></div>
            <h3>五条人</h3>
            <hr>
        <div>
            <input type="checkbox">qweqwe<br>
            <input type="checkbox">qweqwe<br>
            <input type="checkbox">qweqwe<br>
            <input type="checkbox">qweqwe<br>
            <input type="checkbox">qweqwe<br>
            <input type="checkbox">qweqwe<br>
            <input type="checkbox">qweqwe<br>
            <input type="checkbox">qweqwe<br>
        </div>
        <div class="panel-footer">
            <hr>
            <button id="allSelect">全选</button>
            <button id="cancelSelect">取消全选</button>
            <button id="recerseSelect">反选</button>
        </div>
    </div>
    <script type="text/javascript">
        function $(id){
            return typeof id==='string'?document.getElementById(id):null;
        }
            var inputs=document.getElementsByTagName('input');
            //quanxian 
            $('allSelect').onclick=function(){
                for(var i=0;i<inputs.length;i++){
                    inputs[i].checked=true;
                }
            }
            $('cancelSelect').onclick=function(){
                for(var i=0;i<inputs.length;i++){
                    inputs[i].checked=false;
                }
            }
            $('recerseSelect').onclick=function(){
                 for(var i=0;i<inputs.length;i++){
                    inputs[i].checked=!inputs[i].checked;
                 }
            }
 
    </script>
</body>
</html>